//
//  ViewController.m
//  07-UIViewControllerLifCycle
//
//  Created by GivenBmli on 16/7/22.
//  Copyright © 2016年 GivenBmli. All rights reserved.
//

#import "ViewController.h"
#import "FirstViewController.h"

@interface ViewController ()

@end

@implementation ViewController
// loadView 与 viewDidLoad 只运行了一次
- (void)loadView{
    [super loadView];
    NSLog(@"%@------%s",[self class],__FUNCTION__);
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    NSLog(@"%@------%s",[self class],__FUNCTION__);
    self.view.backgroundColor = [UIColor redColor];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(barButtonClicked:)];
    
}

// 视图将要出现,就会调用
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"%@------%s",[self class],__FUNCTION__);
}


//视图完全出现时,就会调用
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    NSLog(@"%@------%s",[self class],__FUNCTION__);
}
//视图将要消失时,就会调用 (只要消失一点)
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
    NSLog(@"%@------%s",[self class],__FUNCTION__);
}

// 视图完全出现就会调用
- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    NSLog(@"%@------%s",[self class],__FUNCTION__);
}


#pragma make - buttonClicked

- (void)barButtonClicked:(UIBarButtonItem *)barButtonItem{
    FirstViewController *First= [[FirstViewController alloc]init];
    [self.navigationController pushViewController:First animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
